<template>
	<!-- 既往史详情 -->
	<view>
		<view class="add" @click="C_add">
			<image :src="vuex_httpImageUrl && vuex_httpImageUrl+'static/common/icon_add.png'" mode="widthFix"></image>
			添加{{status.name}}既往史
		</view>
		
		<view class="list">
			<view v-for="(item,index) in list" :key='index' @click="C_detail(item.id)">
				<image :src="vuex_httpImageUrl && vuex_httpImageUrl+'static/common/icon_jws.png'" mode="widthFix"></image>
				上传日期:{{item.uptime}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status:{
					name:'', 
					index:'',
				},
				list:[]
			};
		},
		onLoad(o) {
		 	let { name , index } =  JSON.parse(o.params)
			this.status = { name , index }
			uni.setNavigationBarTitle({title:name})
		},
		onShow() {
			this.def_list(this.status.index)
		},
		methods:{
			async def_list(index){
				let a = await this.$u.api.indexhistory_list({status:index})
				this.list = a.data
			},
			C_add(){
				uni.navigateTo({
					url:'./add/add?obj='+JSON.stringify(this.status)
				})
			},
			C_detail(id){
				uni.navigateTo({
					url:'./detail/detail?id='+id
				})
			}
		}
	}
</script>

<style lang="scss">
	.add{
		text-align: center;
		margin: 50rpx 0;
		font-size: 35rpx;
		display: flex;
		justify-content: center;
		image{
			width: 50rpx;
			height: 50rpx;
			margin-right: 20rpx;
		}
	}
	.list{
		>view{
			width: 90%;
			margin: auto;
			background-color: #FFFFFF;
			margin-bottom: 20rpx;
			padding: 30rpx 50rpx;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			image{
				width: 35rpx;
				height: 35rpx;
				margin-right: 20rpx;
			}
		}
	}
</style>
